Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing Extensions and Drivers /
Chapter 6 - Printing Resources / Printing Resources Reference
Resources Used Only in Printer Drivers


The Communications ('comm') Resource

Each communications ('comm') resource, of type gxDeviceCommunicationsType, defines parameters for a specific communications protocol that is supported by a printer driver. You must include one communications resource for each entry in your look resource. You can define printer communications resources in four different formats: serial communications resources, PAP communications resources, PrinterShare communications resources, and SCSI communications resources.

Serial Communications Resource

You need to define a serial communications resource to support serial communications in your driver. Figure 6-11 shows the structure of this form of a communications resource.

Figure 6-11 The serial communications resource

The serial communications resource consists of a communications type identifier and a number of input and output communications values.

Table 6-14 shows the values that you can use to specify the baud rate in serial communications resources.
Table 6-14 Constants for the baud rate
ConstantExplanation
baud300300 baud
baud600600 baud
baud12001200 baud
baud18001800 baud
baud24002400 baud
baud36003600 baud
baud48004800 baud
baud72007200 baud
baud96009600 baud
baud1920019200 baud
baud3840038400 baud
baud5760057600 baud

Table 6-15 shows the constants that you can use to specify parity values in serial communications resources.
Table 6-15 Parity constants
ConstantExplanation
noParityParity not used
oddParityUse odd parity
evenParityUse even parity

Table 6-16 shows the constants that you can use to specify stop-bits values in serial communications resources.
Table 6-16 Constants for stop bits
ConstantExplanation
oneStop1
oneFiveStop1.5
twoStop2

Table 6-17 shows the constants that you can use to specify data-bits values in serial communications resources.
Table 6-17 Constants for data bits
ConstantExplanation
data55 data bits
data66 data bits
data77 data bits
data88 data bits

The values that are used to define input and output handshaking in the serial communications resource are shown in Figure 6-12.

Figure 6-12 Input and output handshaking values

The handshake values define parameters of how the driver and the device communicate.

Table 6-18 shows the constants that you can use to specify handshake error-handling in serial communications resources.
Table 6-18 Handshake error types
ConstantValueExplanation
parityErr16Abort the input request if a parity error occurs
hwOverrunErr32Abort the input request if a hardware overrun error occurs
framingErr64Abort the input request if a framing error occurs

Table 6-19 shows the constants that you can use to specify which status changes cause driver events to be posted.
Table 6-19 Status changes that cause driver events to be posted
ConstantValueExplanation
ctsEvent32Causes driver events to be posted if the CTS status changes
breakEvent128Causes driver events to be posted if the break status changes

Listing 6-10 shows an example of a serial communications resource.

Listing 6-10 An example of a serial communications resource

resource gxDeviceCommunicationsType (-4095, sysHeap, purgeable)
{
   Serial
      {
      baud9600,      /* output baud rate */
      noParity,      /* output parity */
      oneStop,       /* output stop bits */
      data8,         /* output data size */
      0x00010000,    /* output handshaking */
      0x00000000, 
      baud9600,      /* input baud rate */
      noParity,      /* input parity */
      oneStop,       /* input stop bits */
      data8,         /* input data size */
      0,             /* input handshaking */
      0,
      1024,          /* input buffer size */
      ".Ain",        /* input driver name; Chooser fills in */
      ".Aout"        /* output driver name; Chooser fills in  */
      };
};
This example defines a serial port that supports input and output using the same parameters: 9600 baud, no parity, 1 stop bit, and 8 data bits. The input buffer size is
1024 bytes long.

AppleTalk PAP Communications Resource

You need to define a PAP communications resource to support the AppleTalk Printer Access Protocol in your driver. Figure 6-13 shows the structure of this form of a communications resource.

Figure 6-13 The PAP communications resource

The PAP communications resource consists of a communications type identifier and a number of input and output communications values.

Listing 6-11 shows an example of a PAP communications resource that defines an AppleTalk connection for an ImageWriter II printer, which uses a flow quantum value of 1.

Listing 6-11 An example of an AppleTalk communications resource

resource gxDeviceCommunicationsType(-4096, sysHeap, purgeable)
{
   PAP
      {
      1,             /* flow quantum */
      ""             /* AppleTalk address; Chooser fills in */
      0, 0, 0, 0
      };
};

PrinterShare Communications Resource

You need to define a PrinterShare communications reource to support a server connection to your driver. Figure 6-14 shows the structure of this form of a communications resource.

Figure 6-14 The PrinterShare communications resource

The PrinterShare communications resource consists of a communications type identifier and a number of input and output communications values.

Listing 6-12 shows an example of a PrinterShare communications resource that defines a print server's connection for an ImageWriter II printer.

Listing 6-12 An example of a PrinterShare communications resource

resource gxDeviceCommunicationsType (-4094, sysHeap, purgeable)
{
   PrinterShare,
      {
      "",            /* AppleTalk address; Chooser fills in */
      0
      };
};

SCSI Communications Resource

You need to define a SCSI communications resource for SCSI output devices. The structure of this form of a communications resource is shown in Figure 6-15. Although QuickDraw GX provides the SCSI communications resource, it does not provide a default implementation of the device communications messages for SCSI devices. If you are implementing a printer driver for a SCSI device, you must override the device communications messages, which are described in the chapter "Printing Messages" in this book.

Figure 6-15 The SCSI communications resource

The SCSI communications resource consists of a communications type identifier and a number of SCSI control values.

Listing 6-13 shows an example of a SCSI communications resource that defines a SCSI communications connection for a LaserWriter IISC printer.

Listing 6-13 An example of a SCSI communications resource

resource gxDeviceCommunicationsType (-4095, sysHeap, purgeable)
{
   SCSI
   {
      0,          /* release device routine */
      0,          /* I/O attibutes */
      0,          /* status byte */
      0,          /* SCSI bus number */
      0,          /* SCSI ID */
      0,          /* chunk level */
      0,          /* acquire routine (use default) */
      2,          /* device type to look for */
      27,         /* minimum length of additional response data */
      8,          /* bytes from start for search */
      "APPLE   PERSONAL LASER  ",   /* search string */
   };
};
Note
QuickDraw GX provides the SCSI communications resource type and supports it in the Chooser. However, QuickDraw GX does not provide a default implementation of SCSI printer communications. If you are implementing a driver for a SCSI printer, you must override all of the communications messages. These messages are described in the chapter "Printing Messages" in this book.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help